<?php

// phpMyRealty 3
//
// File Name: validate.php
// File Location : ./
//
// Copyright (c)2009 phpMyRealty.com
//
// e-mail: support@phpMyRealty.com

// Include configuration file and general functions
define('PMR', 'true');

include ( './config.php' );
include ( PATH . '/defaults.php' );

// ----------------------------------------------------------------------

// Title tag content
$title = $conf['website_name_short'] . ' - ' . $lang['Email_validate'];

// Template header
include ( PATH . '/templates/' . $cookie_template . '/header.php' );

echo table_header ( $lang['Email_validate'] );

if (isset($_GET['id']) && eregi('^[0-9]+$', $_GET['id'])) {

 $sql = 'UPDATE '. USERS_TABLE . ' SET approved = "1" WHERE number = "' . $_GET['id'] . '" LIMIT 1';
 $db->query($sql) or error ('Critical Error', mysql_error ());

 $sql = 'SELECT * FROM '. USERS_TABLE . ' WHERE number = "' . $_GET['id'] . '" and approved = 1 LIMIT 1';
 $r=$db->query($sql) or error ('Critical Error', mysql_error ());

 if ($db->numrows($r) > 0)
  echo $lang['Validation_Correct'];
 else
  echo $lang['Validation_Incorrect'];

}

echo table_footer ( );

// Template footer
include ( PATH . '/templates/' . $cookie_template . '/footer.php' );

?>